<template>
  <div>
    <h2>学生管理</h2>
    <Add @show="show" />
    <Update :student="student"  @setStudent="setStudent"/>
    <Search @show="show" />
    <List :students="students" @show="show" @setStudent="setStudent"/>
  </div>
</template>

<script>
import Add from '../components/student/Add';
import Update from '../components/student/Update';
import Search from '../components/student/Search';
import List from '../components/student/List';
import {find} from '../services/student';
export default {
  components:{
    Add,Update,Search,List
  },
  data(){
    return {
      students:[],
      student:{}
    }
  },
  created(){
    this.show();
  },
  methods:{
    async show(params){
        let res = await find(params);
        this.students = res.rows;
    },
    setStudent(student){
      this.student = student;
    }
  }
}
</script>

<style>

</style>